<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.model.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.util.*"%>
<%@ page import="com.x4ee.soa.portal.framework.tools.*"%>
<%@ page import="javax.persistence.*"%>
<%String contextPath = request.getContextPath();%>
<portlet:defineObjects />
<form method='post' action='<portlet:actionURL><portlet:param name="frameworkUri" value="privilegeStrategyOperateAction"/><portlet:param name="cmd" value="edit"/></portlet:actionURL>'>
<table>
	<tr>
		<td valign="top">
			<table>
				<tr><td><a href='<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="EditIndex"/></portlet:renderURL>'>[发布课程]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="TrainingSubjectCreate"/></portlet:renderURL>'>[授课科目]</a></td></tr>				
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="TrainingAddressCreate"/></portlet:renderURL>'>[授课地点]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="PrivilegeStrategyCreate"/></portlet:renderURL>'>[优惠策略]</a></td></tr>				
				<tr><td><a href='<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="SubscribeOrderView"/></portlet:renderURL>'>[处理订单]</a></td></tr>				
			</table>
		</td>
		<td>
			<table>
			<%List<PrivilegeStrategy> psList = ModelEntityHelper.listPrivilegeStrategy();
			long privilegeStrategyId = DataTypeUtil.parseLong(renderRequest.getParameter("privilegeStrategyId"));
				EntityManager em = EntityManagerHelper.getEntityManager();
				if(privilegeStrategyId>=0){
					PrivilegeStrategy tps = em.find(PrivilegeStrategy.class,privilegeStrategyId);
					if(tps!=null){%><input name="privilegeStrategyId" type="hidden" value="<%=privilegeStrategyId%>"/>				
<tr><th colspan="2" align="left" style="font-size: 13">修改优惠策略</th></tr>
<tr><td colspan="2"><table><tr><td align="left">策略描述:</td><td><input name="description" value="<%=tps.getDescription()%>"  type="text" size="40" class="textfield"/></td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left">折扣比率:</td><td><input name="discount" value="<%=tps.getDiscount()%>" type="text" size="4" class="textfield"/>&nbsp;%</td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left"><input type="image" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/edit.jpg" name="Submit" value="修改"></td></tr></table></td></tr>
				<%}}EntityManagerHelper.closeEntityManager();%></table>
		</td>
		<td valign="top">
			<table border="1">
			<tr><td>优惠策略</td><td>折扣比率</td><td>操作</td></tr>
			<%for(Iterator<PrivilegeStrategy> psIt = psList.iterator();psIt.hasNext();){
				PrivilegeStrategy ps = psIt.next();%>
				<tr><td><strong><%=ps.getDescription()%></strong></td>
				<td align="center"><strong><%=ps.getDiscount()%>%</strong></td>
				<td><a href="<portlet:renderURL><portlet:param name="frameworkUri" value="PrivilegeStrategyEdit"/><portlet:param name="privilegeStrategyId" value="<%=ps.getId()+""%>"/></portlet:renderURL>">[编辑]</a>
				<a href="<portlet:actionURL><portlet:param name="frameworkUri" value="privilegeStrategyOperateAction"/><portlet:param name="privilegeStrategyId" value="<%=ps.getId()+""%>"/><portlet:param name="cmd" value="delete"/></portlet:actionURL>">[删除]</a></td></tr><%
			}%>
			</table>
		</td>		
	</tr>
</table>
</form>
